package com.qcby.llmtchstd.controller;

import com.qcby.llmtchstd.common.ResponseResult;
import com.qcby.llmtchstd.entity.Note;
import com.qcby.llmtchstd.entity.Student;
import com.qcby.llmtchstd.service.NoteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping(value = "/note")
@Api(tags = "笔记管理")
public class NoteController {
    @Autowired
    private NoteService noteService;

    @RequestMapping(value = "/count",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取数量" )
    public ResponseResult count(@RequestBody Integer id){
        return noteService.count(id);
    }

    @RequestMapping(value = "/page",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("显示笔记信息" )
    public ResponseResult page(@RequestBody Note note){
        return noteService.page(note);
    }

    @RequestMapping(value = "/search",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("查询笔记信息" )
    public ResponseResult search(@RequestBody Note note){
        return noteService.search(note);
    }

    @RequestMapping(value = "/serCount",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取搜索后的数量" )
    public ResponseResult serCount(@RequestBody Note note){
        return noteService.serCount(note);
    }

    @RequestMapping(value = "/delete",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("删除笔记信息" )
    public ResponseResult delete(@RequestBody Integer id){
        return noteService.delete(id);
    }

    @RequestMapping(value = "/insert", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("添加笔记")
    public ResponseResult insert(@RequestBody Note note) {
        return noteService.insert(note);
    }

    @RequestMapping(value = "/update", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("修改笔记")
    public ResponseResult update(@RequestBody Note note) {
        return noteService.update(note);
    }

    @RequestMapping(value = "/edit", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取单个笔记信息")
    public ResponseResult edit(@RequestBody Integer id) {
        return noteService.edit(id);
    }

    @RequestMapping(value = "/selectById", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("根据ID查询笔记详情")
    public ResponseResult selectById(@RequestBody Integer id) {
        return noteService.selectById(id);
    }


}

